package com.ldzy.service.serviceIpmI;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ldzy.dao.UserMapper;
import com.ldzy.pojo.User;
import com.ldzy.service.IUserService;
import com.ldzy.utilts.RespUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class IUserServiceIpmI extends ServiceImpl<UserMapper, User> implements IUserService {
 @Resource UserMapper userMapper;
    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public RespUtil updatePwd(User user) {
        if (userMapper.updatePwd(user)!=0)
            return  RespUtil.success("修改密码成功！！");
        return  RespUtil.error("修改密码失败！！");
    }

    @Override
    public RespUtil findByUserAccount(User user) {
        if (userMapper.findByUserAccount(user)!=null)
            return  RespUtil.success(userMapper.findByUserAccount(user));
        return  RespUtil.error();
    }

    @Override
    public boolean isPhone(User user) {
     if(userMapper.isPhone(user)!=null)
         return  true;
     return  false;
    }

    @Override
    public Boolean adduser(User user) {
       if (userMapper.adduser(user)!=0)
           return  true;
       return false;
    }

    @Override
    public Boolean updateUserMoney(User user) {
        if (userMapper.updateUserMoney(user)!=0)
            return  true;
        return  false;
    }

    @Override
    public Boolean updateInformation(User user) {
        System.out.println(user.getUserPhone());
        if (userMapper.updateInformation(user)!=0)
            return  true;
        return  false;
    }

    @Override
    public Boolean moneyPay(User user) {
        if (userMapper.moneyPay(user)!=0)
            return  true;
        return  false;
    }
}
